import formBuilder from "@/comps/form/formBuilder";
import api from "./api";
import apiSubject from "@/pages/v1/study/Subject/js/apiSubject";
import apiGrade from "@/pages/v1/study/Grade/js/apiGrade";
import apiKnowledge from "@/pages/v1/study/Knowledge/js/apiKnowledge";
/*
fb.addText("read","读",3)
fb.addText("write","写",3)
fb.addText("note","说明",3)
fb.addText("subject","学科",3)
fb.addText("grade","年级",3)

* */
export default {
    main:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100)
        fb.addSelect("gradeId","年级",3).setApi(apiGrade.urlChoice)
        fb.addSelect("subjectId","学科",3).setApi(apiSubject.urlChoice)
        fb.addSelect("knowledgeId","知识点",6).setApi(apiKnowledge.urlChoice)
        fb.addText("write","写",3)
        fb.addText("read","读",3)
        fb.addText("sense","义",6)
        fb.addText("note","说明",12).setMulti(true).setRows(3)

        return fb
    },
    tree:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100)

        fb.addCascade("parentId").setLabel("上级分类").setSpan(3)
            .setApi(api.urlTree)

        fb.addText("name").setSpan(6).setLabel("分类名称")
            .setRules([fb.R.notNull("名称不能为空")])

        fb.addText("sort").setSpan(3).setLabel("排序").setTypeNumber()
        return fb
    },
    other:function () {
        let fb = formBuilder()
        fb.setLabelWidth(100).setLabelPosition("right")

        return fb
    }
}